-
Notifications
You must be signed in to change notification settings - Fork 631
fix: location channel manager #516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| locationManager.requestLocationUpdates( | ||
| provider, | ||
| 2000L, | ||
| 5f, | ||
| continuousLocationListener |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated beginLiveRefresh piles up location listeners
The new real-time refresh registers continuous updates every time beginLiveRefresh is called, but unlike the previous timer-based implementation it never removes an existing listener before calling requestLocationUpdates. In LocationChannelsSheet the LaunchedEffect keyed on availableChannels and bookmarks re-invokes beginLiveRefresh on each channel update while the sheet stays open, so every location result triggers another registration to the same continuousLocationListener. This stacks multiple active listeners, causing duplicate callbacks and unnecessary background location polling (battery and compute overhead) until the sheet is dismissed.
Useful? React with 👍 / 👎.
|
I've pushed a fix (commit
|
|
I've merged Conflict Resolution:
|
Summary
This PR refactors
LocationChannelManagerto use native AndroidLocationManagerupdates instead of a coroutine-based polling mechanism for live location refreshing.Key Changes
refreshTimer(polling loop) withcontinuousLocationListenerregistered viarequestLocationUpdates.endLiveRefreshandcleanup.startBackgroundLocationUpdatesandstopBackgroundLocationUpdateshelper methods (currently unused).LocationListenercallbacks.Impact